package com.fish.common.constant;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import com.fish.vo.PageElementModel;
/**
 * 常量上下文
 * @author clj
 *
 */
public class Constant {
	private static Properties properties;
	private static volatile Constant instance=null;
	public static String SESSION_BACK_USER_KEY= "SESSION_BACK_USER_KEY";
	public static long DEFAULT_PAGE_SIZE= 10;
	/**
	 * 发送二维码费用
	 */
	public static Double PAY_CODE_AMOUNT=1D;
	/**
	 * 刷码费用
	 */
	public static Double PAY_USE_CODE_AMOUNT=1D;
	/**
	 * 平台账户
	 */
	public static String ADMIN_USER="000000000000000000000001";
	private void init() {
		try {
			properties = new Properties();
			properties.load(getClass().getResourceAsStream("/config/const.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	private Constant(){
		init();
	}
	public static Constant getInstance() {
		if (instance == null) {
			synchronized (Constant.class) {
				if(instance==null){					
					instance = new Constant();
				}
			}
		}
		return instance;
	}
	
	public static enum EVENT_TYPE{
		  MES_TOP
	}
	/**
	 * 产品类型
	 * 
	 * @author clj
	 * 
	 */
	public static enum PRODUCT_TYPE {
		/**
		 * 门票
		 */
		TICKET,
		/**
		 * 自由行
		 */
		FREETRAVEL,
		/**
		 * 国内游
		 */
		INNER_TRAVEL,
		/**
		 * 出境游
		 */
		OUTER_TRAVEL,
		/**
		 * 酒店
		 */
		HOTILE
	}
	public static boolean isActualApplyPassCode(){
		return true;
	}
	public static boolean isJobRunnable(){
		return true;
	}
	
	/**现金账户操作类型**/
	public static enum ACCOUNT_TYPE {
		RECHARGE("充值"),
		DRAWOUT("提现 "),
		REFUND("退款 "),
		PAYMENT("支付 ");
		private String cnName;
		ACCOUNT_TYPE(String name){
			this.cnName=name;
		}
		public String getCode(){
			return this.name();
		}
		public String getCnName(){
			return this.cnName;
		}
		public static List<PageElementModel> getList(){
			List<PageElementModel> list=new ArrayList<PageElementModel>();
			PageElementModel sm=null;
			for(ACCOUNT_TYPE item:ACCOUNT_TYPE.values()){
				sm=new PageElementModel();
				sm.setElementCode(item.getCode());
				sm.setElementValue(item.getCnName());
				list.add(sm);
			}
			return list;
		}
		public String toString(){
			return this.name();
		}
	}
}
